package kotlincomtest

import org.junit.Test

class TestEquals {

    @Test
    fun testEquals() {
        //==比较值相等
        //===比较引用是否相等(是否指向同一个对象)
        val d0 = 10

        val d1 = 10

        println(d0 == d1)
        println(d0 === d1)

        val a1 = Integer.valueOf(136)
        val a2 = Integer.valueOf(136)

        println(a1 == a2)
        println(a1 === a2)

        val linkedHashMap = LinkedHashMap<String, String>(16, 0.75F, true)
        linkedHashMap["a"] = "A"
        linkedHashMap["b"] = "B"
        linkedHashMap["c"] = "C"
        linkedHashMap["d"] = "D"
        linkedHashMap["e"] = "E"
        linkedHashMap["f"] = "F"

        for ((key, value) in linkedHashMap) {
            println("key:${key},value:${value}")
        }

        linkedHashMap["a"]

        linkedHashMap["g"] = "G"

        println("===============================")

        for ((key, value) in linkedHashMap) {
            println("key:${key},value:${value}")
        }
    }
}